<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<body>
<h1>教务系统</h1>
<h2>成绩管理</h2>
<form th:action="@{/searchScores}" th:method="get">
<input type="text" name="id" placeholder="请输入学号查询"/>
<input type="submit" value="查询">
</form>
<a th:href="@{/scores}">查询全部</a>
<a th:href="@{/addscorepage}">添加</a>
<table border="1">
  <tr>
    <td>id</td>
    <td>学号</td>
    <td>姓名</td>
    <td>课程号</td>
    <td>课程名</td>
    <td>分数</td>
    <td>删除操作</td>
    <td>更新操作</td>
  </tr>
  <tr th:each="score,iterStat:${scores}">
    <td th:text="${score.id}"></td>
    <td th:text="${score.studentId}"></td>
    <td th:text="${score.student.name}"></td>
    <td th:text="${score.courseId}"></td>
    <td th:text="${score.course.name}"></td>
    <td th:text="${score.score}"></td>
    <td>
      <a th:href="@{/deletescore/{id}(id=${score.id})}">删除</a>
    </td>
    <td >
      <a th:href="@{/updatescorepage/{id}(id=${score.id})}">更新</a>
    </td>
<!--    显示第一条平均分并且跨行-->
    <td th:if="${iterStat.index == 0}" th:rowspan="${totalCount}" th:text="${scoreAvg}"></td>
  </tr>
</table>
</body>
</html>